package com.gz.controller;

import com.gz.common.AdService;
import com.gz.common.Constant;
import com.gz.common.CouponService;
import com.gz.common.model.Ad;
import com.gz.common.model.Coupon;
import com.gz.utils.Response;
import com.jfinal.core.Controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by gongzhen on 2018/6/2.
 */
public class AdController extends Controller {

    public void getAd() {

        List<Ad> adList = AdService.getService().getAd();
        if(adList!=null){
            for(Ad ad:adList){
                ad.setThumbnail(Constant.FILE_PATH+ad.getThumbnail());
            }
        }
        Map<String,List<Ad>>maps= new HashMap<>();
        maps.put("list",adList);
        renderJson(Response.responseJson(200, "成功", maps));
    }
}
